package com.atguigu.lease.common.exceptionhandler;

import com.atguigu.lease.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BusiException.class)
    public Result BusiExceptionHandler(BusiException e){
        return Result.fail(null,e.getCode(),e.getMessage());
    }
    @ExceptionHandler(Exception.class)
    public Result ExceptionHandler(Exception e){
        e.printStackTrace();
        return Result.fail();
    }
}
